package com.cavy.platform.server.domain;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@EqualsAndHashCode(callSuper = true)
@Data
public class StringConfigMap extends AbstractConfigMap {
    private String value;

    public StringConfigMap() {
        type = ConfigMapType.STRING;
    }

    @Override
    public void getValue(HttpServletResponse response) {
        try (PrintWriter writer = response.getWriter();) {
            writer.write(value);
            writer.flush();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
